//! 命名服务错误定义

use thiserror::Error;
use nacos_core::NacosError;

#[derive(Debug, Error)]
pub enum NamingError {
    #[error("服务未找到: {0}")]
    ServiceNotFound(String),

    #[error("实例未找到: {0}")]
    InstanceNotFound(String),

    #[error("无效的服务名: {0}")]
    InvalidServiceName(String),

    #[error("无效的集群: {0}")]
    InvalidCluster(String),

    #[error("元数据错误: {0}")]
    Metadata(String),
}

impl From<NamingError> for NacosError {
    fn from(err: NamingError) -> Self {
        NacosError::Naming(err.to_string())
    }
}
